package com.yn.work;

import com.rabbitmq.client.Channel;
import com.yn.utils.MQUtil;

/**
 * @ClassName: Task
 * @Description:
 * @author: 王胜
 * @date 2021/6/17
 * @Version: 1.0
 **/
public class Task {
    public static final String QUEUE_NAME="hello";
    public static void main(String[] args) throws Exception {
        Channel channel = MQUtil.getChannel();
        channel.queueDeclare(QUEUE_NAME,true,false,false,null);
//        开启发布确认模式
//        channel.confirmSelect();
        for (int i = 0; i < 10; i++) {
            channel.basicPublish("",QUEUE_NAME,null,("String"+i).getBytes());
//            增加异步确认监听事件
//            channel.addConfirmListener((deliveryTag,multiple)->{}, (deliveryTag,multiple)->{});
        }
        MQUtil.close();
    }
}
